package com.project.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.BuyOrderBean;
import com.project.mapper.IBuyOrderMapper;
import com.project.service.IBuyOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

@Service
@Transactional
public class BuyOrderServiceImpl implements IBuyOrderService {
    @Autowired
    private IBuyOrderMapper buyOrderMapper;
    @Override
    public Integer add(BuyOrderBean buyOrder) {
        return buyOrderMapper.insert(buyOrder);
    }

    @Override
    public BuyOrderBean findByOrderId(Integer buyOrderId) {
        return buyOrderMapper.findByOrderId(buyOrderId);
    }

    @Override
    public IPage<BuyOrderBean> findByItem(Integer pageNO, String ventorName, LocalDate startDate, LocalDate endDate) {
        return buyOrderMapper.findByItem(new Page<>(pageNO,3),ventorName,startDate,endDate);
    }
}
